Skip to content

Improve binary search#14455

Open
Mias007 wants to merge 4 commits intoTheAlgorithms:masterfrom
Mias007:improve-binary-search
Open

Improve binary search#14455
Mias007 wants to merge 4 commits intoTheAlgorithms:masterfrom
Mias007:improve-binary-search

Conversation

@Mias007
Copy link
Copy Markdown

@Mias007 Mias007 commented Mar 26, 2026

Description

Improved binary search implementations by:

  • Refactoring code for better readability and consistency
  • Removing redundant validation in recursive implementation
  • Adding type hints to improve code clarity
  • Enhancing doctests for better coverage
  • Minor performance improvements by avoiding repeated checks

Checklist

  • I have read the contributing guidelines
  • I have followed the project structure
  • I have tested my code locally (doctest, ruff, mypy)
  • This is not a duplicate implementation

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Mar 26, 2026
@Mias007 Mias007 force-pushed the improve-binary-search branch from f698618 to 9fc506c Compare March 26, 2026 20:20
@Mias007 Mias007 requested a review from cclauss as a code owner March 26, 2026 20:20
@Mias007 Mias007 force-pushed the improve-binary-search branch from 9fc506c to 5aec7ba Compare March 26, 2026 20:26
try:
return int(image[x_coordinate][y_coordinate] >= center)
except (IndexError, TypeError):
except IndexError, TypeError:
Copy link
Copy Markdown
Member

@cclauss cclauss Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must be using Python < 3.14, but this repo ALWAYS uses the latest current Python.

Also, please make sure that you are using the latest version of ruff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants